package Ar;

import java.util.Arrays;

/**
 * @Author MDD
 * @Description
 * @Version
 * @Date
 **/
public class bubbleSort02 {
    public static void main(String[] args) {
        int[] num = {7, 9, 6, 5, 1};
        int temp;
        int size = num.length;
        for (int i = 0; i < size - 1; i++) {
            for (int j = i + 1; j < size; j++) {
                if (num[i] > num[j]) {
                    temp = num[i];
                    num[i] = num[j];
                    num[j] = temp;
                }
            }
        }
        System.out.println(Arrays.toString(num));
        System.out.println("=======================");

        int[] ar = {7, 9, 6, 5, 1};
        int i = 0;
        int j = ar.length - 1;
        int m = 0;
        while (i < j) {
            m = ar[i];
            ar[i] = ar[j];
            ar[j] = m;
            i++;
            j--;
        }
        System.out.println(Arrays.toString(ar));
    }
}
